package org.example.ch03;

import java.util.concurrent.Callable;

/**
 * @author yang
 * @date 2024-03-19
 */
public class GetSum implements Callable<Integer> {

    private int from ;
    private int to ;

    public GetSum(int from, int to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public Integer call() throws Exception {
        int sum = 0;
        for (int i = this.from; i <= this.to; i++) {
            sum += i;
        }
        System.out.println("sum:"+sum);
        return sum;
    }

}
